// -------------------------------------------------------------
// common: queryRecordsInfoBatch
// time: 2020-07-25
// author: minner
// -------------------------------------------------------------
exports.queryRecordsInfoBatch = function (obj_batch, callback) {
    // obj_batch = {
    //     "keyname1": { table, pkey, ids, fields },
    //     "keyname2": { table, pkey, ids, fields },
    // };
    var batch_keys = Object.keys(obj_batch);

    var batch_result = {}, result_count = 0;
    var tmp_callback = function (keyname, obj_result) {
        result_count++;
        batch_result[keyname] = obj_result;
        if (result_count == batch_keys.length) {
            callback(batch_result);
        }
    }
    batch_keys.forEach(element => {
        let tmp_query = obj_batch[element];
        uim.commons.queryRecordsInfo(tmp_query.table, tmp_query.pkey, tmp_query.ids, tmp_query.fields, function (obj_result) {
            tmp_callback(element, obj_result);
        });
    });
};
